// eslint-disable-next-line jsx-a11y/href-no-hash,jsx-a11y/img-has-alt,jsx-a11y/no-marquee
/* eslint-disable function-paren-newline */
import React, { Component } from 'react';
import fetch from 'dva/fetch';
import reactComponentDebounce from 'react-component-debounce';
import { Form, InputNumber, Checkbox, DatePicker, Input, Select, Icon, message, Cascader, Radio, AutoComplete } from 'antd';
import styles from '../../../index.less';
import * as config from '../../../utils/config';
import * as businessconfig from '../../../utils/businessconfig';
import * as commonFunc from '../../Common/commonFunc';
import Provinces from '../../../assets/provinces.json';
import Cities from '../../../assets/cities.json';
import Areas from '../../../assets/areas.json';

const FormItem = Form.Item;
const InputGroup = Input.Group;
const { Option } = Select;
const { TextArea } = Input;
const InputNumberA = reactComponentDebounce(500)(InputNumber);
const InputA = reactComponentDebounce(500)(Input);
const RadioGroup = Radio.Group;

/**
 * 控件组件
 * eg. <ShowType required/> required为必填
 */
class ShowType extends Component {
  constructor(props) {
    super(props);
    this.state = {
      sName: props.sName, /* 显示字段名 */
      showDefaultName: props.showDefaultName, /* 默认显示 */
      showConfig: props.showConfig, /* 显示配置 */
      sActiveId: props.sActiveId, /* 窗体Id */
      sId: props.sId, /* 业务数据Id */
      dataList: props.dataList, /* 数据 */
      specific: props.specific, /* 个性化标志 */
      specificData: props.specificData, /* 个性化数据 */
      disabled: props.disabled, /* 是否是查看状态 */
      editable: props.editable, /* 表格是否呈编辑状态 */
      dataValue: '',
      modalVisible: false, /* 下拉弹出框是否展示 */
      modalPanel: { }, /* 弹出面板配置 */
      dataName: props.dataName, /* showType所属数据集名称 用于通用弹窗回带值设值 */
      dataType: props.dataType, /* showType所属数据集类型Map-对象 List-数组 用于通用弹窗回带值设值 */
      dateFormat: commonFunc.getDateFormat(props.app.systemData),
    };
    this.sqlData = []; /* 下拉sql数据集,用于避免重复进行后台取数动作 */
    this.newSqlDataFlag = false;/* 是否需要重新加载下拉数据集 */
  }

  componentWillMount() {
    const { showConfig, sActiveId } = this.state;
    const { useParentName } = this.props;

    /* 下拉新增 */
    const sName = useParentName === undefined ? (showConfig !== undefined && showConfig !== '' ? showConfig.sName : this.state.sName) : this.state.sName;
    const iVisCount = showConfig !== undefined ? showConfig.iVisCount || 1 : 0;
    const sDropDownType = showConfig !== undefined && showConfig !== '' ? showConfig.sDropDownType !== undefined ? showConfig.sDropDownType : '' : '';
    const oPtinon = [];
    const sSqlCondition = this.props.sSqlCondition !== undefined ? this.props.sSqlCondition : '';
    const firstDataIndex = sName.substring(0, 1);
    if (firstDataIndex === 's' && sDropDownType === 'sql') {
      this.fecthFromDb(sName, iVisCount, oPtinon, showConfig, sActiveId, sSqlCondition);
    }
  }

  componentWillReceiveProps(nextProps) {
    const { systemData } = nextProps.app;
    const dateFormat = commonFunc.getDateFormat(systemData);
    const {
      showConfig, sActiveId, sId, dataList, disabled, editable, specific,
    } = nextProps; /* 显示配置 */
    this.setState({
      showConfig, sActiveId, sId, dataList, disabled, editable, specific, dateFormat,
    });
  }
  /* 弹窗改变，目前仅为了屏蔽警告特别添加 */
  hanglePpupChange = () => {
  };

  handleChange = (value) => {
    console.log(`Selected: ${value}`);
  };

  /* 标签页单据新增 */
  handleAddTab= () => {
    const { dispatch } = this.props;
    /* 新Tab标签Id */
    const paneKey = new Date().getTime().toString();
    /* 窗体Id */
    const { sActiveId } = this.props.showConfig;
    /* 当前标签页TabId */
    const sTabId = this.props.app.currentPane.key;
    const sNameUrl = `${config.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`;
    dispatch({
      type: 'content/getUrlData',
      payload: {
        url: sNameUrl, sTabId: paneKey, urlDataType: 'newPane', disabled: false, sParentId: sTabId,
      },
    });
  };

  /* 下拉新增及下拉多字段赋值 */
  handleNewRecord = (value, option) => {
    const { showConfig } = this.state;
    const { sName } = showConfig;
    if (value === '000') {
      this.handleAddTab();
      businessconfig.clearlist(sName);
      /* 以下代码为可用的弹出model形式代码,现下拉新增需改为单据，所以采用上面新增标签页方式 */
      /* let pane = this.modalPanel;
       if (pane === undefined) {
       pane = {};
       }
       let mainConfig = '';
       if (this.props.handleSelf) {
       mainConfig = this.props;
       } else {
       mainConfig = this.props.app.currentPane;
       }

       if (Object.keys(pane).length > 0) {
       const paneKey = new Date().getTime().toString();
       if (this.props.handleSelf) {
       /!* secondPane弹窗面板上保存的ID使用父级的ID,确保回带后可准确找到相应的返回面板 *!/
       this.props.onAddSecondPane({ ...pane, key: this.props.sTabId });
       this.props.handleModalPane({ ...pane, key: this.props.sTabId });
       } else {
       this.props.onAddPane({ ...pane, key: paneKey });
       this.props.handleModalPane({ ...pane, key: paneKey });
       }
       } else {
       const token = this.props.app.token;
       const options = {
       method: 'GET',
       headers: {
       'Content-Type': 'application/json',
       authorization: token,
       },
       };
       const showConfig = this.state.showConfig;
       const { dataName, dataType } = this.state;
       /!* 弹窗字段 *!/
       const mainKey = showConfig.sName;
       const sActiveId = showConfig.sActiveId;
       const url = `${config.server_host}/gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`;
       fetch(url, options).then(response => response.json()).then((json) => {
       if (json.code === 1) {
       const data = json.dataset.rows[0];
       const paneKey = new Date().getTime().toString();
       const onClose = this.props.onClose;
       pane = { formId: data.sId, route: data.sName, key: paneKey, title: data.sMenuName, modalType: 'select', modalVisible: true, mainConfig, mainKey, dataName, dataType, onClose };
       if (this.props.handleSelf) {
       this.props.onAddSecondPane({ ...pane, key: this.props.sTabId });
       this.props.handleModalPane({ ...pane, key: this.props.sTabId });
       } else {
       this.props.onAddPane({ ...pane });
       this.props.handleModalPane({ ...pane });
       }
       this.modalPanel = pane;
       this.newSqlDataFlag = true;
       } else {
       message.error(json.msg);
       }
       });
       }
       const editable = this.state.editable;
       if (editable) {
       /!* 该值如果被手动输入同样会触发StaticEditTable中的onChange事件,概率极低 *!/
       /!* 用于表格弹框赋值回传所在行sId(StaticEditTable中) *!/
       this.props.onChange('ppopupValue');
       } */
    } else if (!this.state.editable) {
      /* 下拉根据赋值字段回填数据 */
      const { dataName, dataType } = this.state;
      const resultFields = [];
      let sAssignFields = showConfig.sAssignField;
      /* 考虑到赋值回带会出现键值对下拉框回带,也会出现直接值回带,所以在配置赋值字段时候采用key:value形式，其中直接返回值为key:value而下拉带回则为key:实际值[-]展示值 */
      if (sAssignFields === undefined || sAssignFields === '') {
        if (showConfig.sName !== '') {
          sAssignFields = `${showConfig.sName}:sId`;
        } else {
          /* 系统参数模块会存在根据sControlName存放值 */
          sAssignFields = `${showConfig.sControlName}:sId`;
        }
      }
      sAssignFields = sAssignFields.split(',');
      if (option.props['data-recordrow'] !== undefined) {
        const recordRow = option.props['data-recordrow'].split('-');
        sAssignFields.map((item) => {
          const itemsplits = item.split(':');
          /* 如果赋值字段配置为key:key[-]value */
          let itemsecondsplits = [];
          let recordRowValue = '';
          /* 赋值字段包含[-]则进行单独处理 */
          if (itemsplits[1].indexOf('[-]') > -1) {
            itemsecondsplits = itemsplits[1].split('[-]');
            const keyValue = recordRow.filter(child => (child !== '' && child.split(':')[0] === itemsecondsplits[0]))[0].split(':')[1];
            const keyValue2 = recordRow.filter(child => (child !== '' && child.split(':')[0] === itemsecondsplits[1]))[0].split(':')[1];
            /* 数据拼接为key:key[-]value格式 */
            recordRowValue = `${itemsplits[0]}:${keyValue}[-]${keyValue2}`;
          }
          /* 赋值字段不包含[-]则通用处理 */
          if (recordRowValue === '') {
            const recordRowValueC = recordRow.filter(child => (child.split(':')[0] === itemsplits[1]))[0];
            recordRowValue = recordRowValueC;
          }
          return resultFields.push({ key: itemsplits[0], value: recordRowValue !== undefined ? recordRowValue.split(':')[1] : '' });
        });
      } else {
        sAssignFields.map((item) => {
          const itemsplits = item.split(':');
          return resultFields.push({ key: itemsplits[0], value: '' });
        });
      }
      if (this.props.handleSelectChange) {
        this.props.handleSelectChange(resultFields, dataType, dataName, this.props.sName);
      }
    }
  };

  /* 弹出框 */
  handlePpopUp = (bEdit) => {
    const { onSlaveAdd, onClose } = this.props;
    const flag = onSlaveAdd ? onSlaveAdd() : false;
    if (flag) return;
    if (!bEdit) {
      let pane = this.modalPanel !== undefined ? this.modalPanel : '';
      const mainConfig = this.props.app.currentPane;
      /* morePopup为单控件根据条件灵活展示多弹窗界面标识，目前为收款单、付款单 */
      if (Object.keys(pane).length > 0 && !this.props.morePopup) {
        const paneKey = new Date().getTime().toString();
        if (this.props.handleSelf) {
          this.props.onAddSecondPane({ ...pane, key: this.props.sTabId });
          this.props.handleModalPane({ ...pane, key: this.props.sTabId });
        } else {
          this.props.onAddPane({ ...pane, key: paneKey });
          this.props.handleModalPane({ ...pane, key: paneKey });
        }
      } else {
        const { token } = this.props.app;
        const options = {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            authorization: token,
          },
        };
        const { showConfig } = this.state;
        /* 弹窗字段 */
        const mainKey = showConfig.sName;
        const resultFields = [];
        let sAssignFields = showConfig.sAssignField;
        /* 考虑到赋值回带会出现键值对下拉框回带,也会出现直接值回带,所以在配置赋值字段时候采用key:value形式，其中直接返回值为key:value而下拉带回则为key:实际值[-]展示值 */
        if (sAssignFields !== undefined && sAssignFields !== '') {
          sAssignFields = sAssignFields.split(',');
          sAssignFields.map((item) => {
            const itemsplits = item.split(':');
            return resultFields.push({ key: itemsplits[0], value: itemsplits[1] });
          });
        }
        const { sActiveId } = showConfig;
        const { dataName, dataType } = this.state;
        const url = `${config.server_host}/gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`;
        fetch(url, options).then(response => response.json()).then((json) => {
          if (json.code === 1) {
            const data = json.dataset.rows[0];
            const paneKey = new Date().getTime().toString();
            pane = {
              formId: data.sId, route: data.sName, key: paneKey, title: data.sMenuName, modalType: 'ppopup', resultFields, modalVisible: true, mainConfig, mainKey, dataName, dataType, onClose,
            };
            if (this.props.cudClose !== undefined) {
              pane.cudClose = true;
            }
            if (this.props.handleSelf) {
              this.props.onAddSecondPane({ ...pane, key: this.props.sTabId });
              this.props.handleModalPane({ ...pane, key: this.props.sTabId });
            } else {
              this.props.onAddPane({ ...pane });
              this.props.handleModalPane({ ...pane });
            }
            this.setState({ modalPanel: pane });
          } else {
            message.error(json.msg);
          }
        });
      }
      const { editable } = this.state;
      if (editable) {
        /* 该值如果被手动输入同样会触发StaticEditTable中的onChange事件,概率极低 */
        /* 用于表格弹框赋值回传所在行sId(StaticEditTable中) */
        this.props.onChange('ppopupValue');
      }
      this.setState({ modalVisible: true });
    }
  };

  /* 常量下拉判断数值回带，目前只用于付款条件 */
  handleConstSelect =(value) => {
    if (this.props.onSelect) {
      this.props.onSelect(value);
    }
  };
  /* 列表数据变更 */
  handleListChange =(value, type, option) => {
    if (type === 'select') {
      /* 下拉根据赋值字段回填数据 */
      const { showConfig } = this.state;
      const resultFields = [];
      let sAssignFields = showConfig.sAssignField;
      /* 考虑到赋值回带会出现键值对下拉框回带,也会出现直接值回带,所以在配置赋值字段时候采用key:value形式，其中直接返回值为key:value而下拉带回则为key:实际值[-]展示值 */
      if (sAssignFields === undefined || sAssignFields === '') {
        sAssignFields = `${showConfig.sName}:sId`;
      }
      sAssignFields = sAssignFields.split(',');
      if (option.props['data-recordrow'] !== undefined) {
        const recordRow = option.props['data-recordrow'].split('-');
        sAssignFields.map((item) => {
          const itemsplits = item.split(':');
          const recordRowValue = itemsplits[1].indexOf('#') > -1 ? itemsplits[1] : recordRow.filter(child => (child.split(':')[0] === itemsplits[1]))[0];
          return resultFields.push({ key: itemsplits[0], value: recordRowValue !== undefined ? recordRowValue.split(':')[1] : '' });
        });
      } else {
        sAssignFields.map((item) => {
          const itemsplits = item.split(':');
          return resultFields.push({ key: itemsplits[0], value: '' });
        });
      }
      this.props.onChange(value, resultFields);
    } else {
      this.props.onChange(value);
    }
  };

  /* 下拉sql获取最新值 */
  handleSqlSelectClick =() => {
    const { showConfig, sActiveId, sName } = this.state;
    const iVisCount = showConfig !== undefined ? showConfig.iVisCount || 1 : 0;
    const oPtinon = [];
    const sSqlCondition = this.props.sSqlCondition !== undefined ? this.props.sSqlCondition : showConfig.sSqlCondition ? showConfig.sSqlCondition : '';
    if (Object.keys(this.sqlData).length <= 1) { /* 小于=1时，重新加载,表示是赋值过来的 */
      businessconfig.clearlist(sName);
    } else if (sName === 'sCustomerId') { // 换客户就要清空印件，以便重新获取本客户的印件
      businessconfig.clearlist('sProductId');
    }
    this.fecthFromDb(sName, iVisCount, oPtinon, showConfig, sActiveId, sSqlCondition);
  };

  handleProvinceChange = (value) => {
    /* 省市区更改 */
    this.props.onChange(value);
  };

  handleCollectData = () => {
    /* 省市区获取数据 */
    const options = [];
    Provinces.forEach((childProvince) => {
      options.push({
        value: childProvince.name, label: childProvince.name, code: childProvince.code, children: [],
      });
    });
    options.forEach((childProvince) => {
      const cities = Cities.filter(item => item.provinceCode === childProvince.code);
      if (cities.length > 0) {
        cities.forEach((childCity) => {
          childProvince.children.push({
            value: childCity.name, label: childCity.name, code: childCity.code, children: [],
          });
        });
      }
    });
    options.forEach((childProvince) => {
      const cities = childProvince.children;
      cities.forEach((childCity) => {
        const areas = Areas.filter((item => item.cityCode === childCity.code));
        if (areas.length > 0) {
          areas.forEach((area) => {
            childCity.children.push({ value: area.name, label: area.name, code: area.code });
          });
        }
      });
    });
    return options;
  };

  fecthFromDb = (sName, iVisCount, oPtinon, showConfig, sActiveId, sSqlCondition) => {
    /* 取数据从数据库中 */
    /*
     else if ((sName === 'sProductId' || sName === 'sProductName') && Object.keys(global.bussnessEle.globeProductlist).length > 0) {
     this.sqlData = global.bussnessEle.globeProductlist;
     return;
     }
     */
    // if (sName === 'sCustomerId' && Object.keys(global.bussnessEle.globeCustomerlist).length > 0 && showConfig.sChinese !== '对象名称') {
    //   this.sqlData = global.bussnessEle.globeCustomerlist;
    //   if (Object.keys(global.bussnessEle.globeCustomerlist).length > 1) {
    //     return;
    //   }
    // } else
    if (sName === 'sSupplyId' && Object.keys(global.bussnessEle.globeSuppylist).length > 0 && showConfig.sChinese !== '对象名称') {
      this.sqlData = global.bussnessEle.globeSuppylist;
      if (Object.keys(global.bussnessEle.globeSuppylist).length > 1) {
        return;
      }
    } else if ((sName === 'sTaxId' || sName === 'sTaxName') && Object.keys(global.bussnessEle.globeTaxlist).length > 0) {
      this.sqlData = global.bussnessEle.globeTaxlist;
      return;
    } else if (sName === 'sWareHouseId' && Object.keys(global.bussnessEle.globeWareHouselist).length > 0) {
      this.sqlData = global.bussnessEle.globeWareHouselist;
      if (Object.keys(global.bussnessEle.globeWareHouselist).length > 1) {
        return;
      }
    } else if (sName === 'sSalesManId' && Object.keys(global.bussnessEle.globeSalesManlist).length > 0) {
      this.sqlData = global.bussnessEle.globeSalesManlist;
      return;
    } else if (sName === 'sGetPayId' && Object.keys(global.bussnessEle.globeGetPaylist).length > 0) {
      this.sqlData = global.bussnessEle.globeGetPaylist;
      return;
    } else if (sName === 'sSenderId' && Object.keys(global.bussnessEle.globeSenderlist).length > 0) {
      this.sqlData = global.bussnessEle.globeSenderlist;
      return;
    } else if (sName === 'sCurrency' && Object.keys(global.bussnessEle.globeCurrencylist).length > 0) {
      this.sqlData = global.bussnessEle.globeCurrencylist;
      return;
    } else if (sName === 'sDeliverId' && Object.keys(global.bussnessEle.globeDeliverlist).length > 0) {
      this.sqlData = global.bussnessEle.globeDeliverlist;
      return;
    }
    const { token } = this.props.app;
    const url = `${config.server_host}business/getSelectDataBysControlId/${showConfig.sId}?sModelsId=${sActiveId}`;
    const values = {
      sKeyUpFilterName: '',
      sSqlCondition,
    };
    const options = {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        authorization: token,
      },
      body: JSON.stringify(values),
    };
    fetch(url, options).then(response => response.json()).then((json) => {
      if (json.code === 1) {
        let showOption = {};
        const { rows } = json.dataset;
        showOption = JSON.parse(JSON.stringify(rows));
        for (const child of showOption) {
          let optionValues = '';
          let recordRow = '';
          const objValue = [];
          for (const key in child) {
            if (Object.prototype.hasOwnProperty.call(child, key)) {
              const name = child[key];
              objValue.push({ key, value: name });
              recordRow = recordRow.concat(`-${key}:${name}`);
            }
          }
          let i = 0;
          while (i < iVisCount) {
            if (objValue.length >= i) {
              const { value } = objValue[i];
              optionValues = optionValues.concat(`-${value}`);
            }
            i += 1;
          }
          optionValues = optionValues.substring(1);
          oPtinon.push(<Option key={child.sId} value={child.sId} data-recordrow={recordRow}>{optionValues}</Option>);
        }
        this.sqlData = showOption;
        if (sName === 'sCustomerId') {
          global.bussnessEle.globeCustomerlist.length = 0;
          global.bussnessEle.globeCustomerlist = [];
          global.bussnessEle.globeCustomerlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sSupplyId') {
          global.bussnessEle.globeSuppylist.length = 0;
          global.bussnessEle.globeSuppylist = [];
          global.bussnessEle.globeSuppylist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sProductId' || sName === 'sProductName') {
          // global.bussnessEle.globeProductlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sTaxId' || sName === 'sTaxName') {
          global.bussnessEle.globeTaxlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sWareHouseId') {
          global.bussnessEle.globeCustomerlist.length = 0;
          global.bussnessEle.globeCustomerlist = [];
          global.bussnessEle.globeWareHouselist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sMaterialsId' || sName === 'sMaterialsName') {
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sSalesManId') {
          global.bussnessEle.globeSalesManlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sGetPayId') {
          global.bussnessEle.globeGetPaylist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sSenderId') {
          global.bussnessEle.globeSenderlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sCurrency') {
          global.bussnessEle.globeCurrencylist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else if (sName === 'sDeliverId') {
          global.bussnessEle.globeDeliverlist = this.sqlData;
          this.forceUpdate(); // 强制重新渲染
        } else {
          this.forceUpdate(); // 强制重新渲染
        }
      }
    });
  };

  handleFields = (object, props) => {
    const { editable, dateFormat } = object;
    /* required字段一般由后台配置的bNotEmpty字段代替，除非写代码时候就必须要该字段必填写死 */
    const { useParentName } = props;
    const { showConfig, disabled } = object;
    /* 下拉新增 */
    const bNewRecode = showConfig !== undefined && showConfig !== '' ? showConfig.bNewRecord : false;
    const showName = showConfig !== undefined && showConfig !== '' ? showConfig.showName : object.showDefaultName;
    const sName = useParentName === undefined ? (showConfig !== undefined && showConfig !== '' ? showConfig.sName : object.sName) : object.sName;
    /* 下拉空 */
    const bFirstEmpty = showConfig !== undefined && showConfig !== '' ? showConfig.bFirstEmpty : false;
    const bReadonly = showConfig !== undefined && showConfig !== '' ? showConfig.bReadonly : false;
    const iTag = showConfig !== undefined && showConfig !== '' ? showConfig.iTag : 0;
    const sDropDownType = showConfig !== undefined && showConfig !== '' ? showConfig.sDropDownType !== undefined ? showConfig.sDropDownType : '' : '';
    const showRequird = showConfig !== undefined && showConfig !== '' ? (showConfig.bNotEmpty === '' ? false : showConfig.bNotEmpty) : '';
    const { iFitWidth } = showConfig;
    const must = (showRequird !== '' ? showRequird : false); /* 是否必填 */
    const { getFieldDecorator } = this.props.form;
    const decimals = props.app.decimals !== undefined ? props.app.decimals : '';
    const floatNum = sName.toLowerCase().endsWith('price')
      ? decimals.dNetPrice
      : sName.toLowerCase().endsWith('money')
        ? decimals.dNetMoney
        : 0; /* 小数位数 */
    let bEdit = false; /* 是否可编辑 */
    if (disabled) {
      bEdit = disabled;
    }
    if (bReadonly === true) {
      bEdit = true;
    }
    if (iTag !== undefined && iTag === 1) {
      /* 不可编辑 */
      bEdit = true;
    } else if (iTag !== undefined && iTag === 2) {
      /* 可编辑 */
      bEdit = false;
    }
    const bVisible = props.bVisible !== undefined ? props.bVisible : showConfig !== undefined ? showConfig.bVisible : true;
    if (editable === undefined) {
      /* 不是表格 */
      const label = showName;
      const classNameStyle = styles.formItemMargin;
      const formItemLayout = this.props.formItemLayout !== undefined
        ? this.props.formItemLayout
        : { labelCol: { span: 7 }, wrapperCol: { span: 15 } };
      let children = '';
      const firstDataIndex = sName.substring(0, 1);
      const iVisCount = showConfig !== undefined ? showConfig.iVisCount || 1 : 0;
      let oPtinon = [];
      if (firstDataIndex === 'i') {
        if (sDropDownType === 'sql') {
          if (Object.keys(this.sqlData).length > 0) {
            for (const child of this.sqlData) {
              /* 展示值 */
              let optionValues = '';
              const objValue = [];
              for (const key in child) {
                if (Object.prototype.hasOwnProperty.call(child, key)) {
                  const name = child[key];
                  objValue.push({ key, value: name });
                }
              }
              let i = 0;
              while (i < iVisCount) {
                if (objValue.length >= i) {
                  const { value } = objValue[i];
                  optionValues = optionValues.concat(`-${value}`);
                }
                i += 1;
              }
              optionValues = optionValues.substring(1);
              oPtinon.push(<Option key={child.sId} value={child.sId}>{optionValues}</Option>);
            }
          }
          if (bFirstEmpty) {
            oPtinon.push(<Option key=" ">--</Option>);
          }
          if (bNewRecode) {
            oPtinon.unshift(<Option key="000">NEW RECORD</Option>);
          }
          children = (
            <FormItem
              label={label}
              {...formItemLayout}
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(
                <Select
                  showSearch
                  disabled={bEdit}
                  filterOption={(input, option) =>
                        option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onSelect={this.handleNewRecord}
                  onFocus={this.handleSqlSelectClick}
                >
                  {oPtinon}
                </Select>)}
            </FormItem>
          );
        } else if (sDropDownType === 'const') {
          const { showDropDown } = showConfig;
          const showOption = JSON.parse(showDropDown);
          /* js遍历map对象 */
          const objValue = [];
          for (const key in showOption) {
            if (Object.prototype.hasOwnProperty.call(showOption, key)) {
              const name = showOption[key];
              objValue.push({ key, value: name });
            }
          }
          /* 控件为radio组 */
          if (this.props.radio) {
            const oPtinonConst = objValue.map(child =>
              <Radio key={child.key} value={Number.parseInt(child.key, 0)}>{child.value}</Radio>);
            children = (
              <FormItem
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(<RadioGroup disabled={bEdit}>{oPtinonConst}</RadioGroup>)}
              </FormItem>);
          } else {
            if (bFirstEmpty) {
              objValue.push({ key: ' ', value: '--' });
            }
            const oPtinonConst = objValue.map(child =>
              <Option key={child.key} value={Number.parseInt(child.key, 0)}>{child.value}</Option>);
            if (this.props.labelNo) {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(
                    <Select
                      showSearch
                      disabled={bEdit}
                      onSelect={this.handleConstSelect}
                      filterOption={(input, option) =>
                          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    >
                      {oPtinonConst}
                    </Select>)}
                </FormItem>
              );
            } else {
              children = (
                <FormItem
                  label={label}
                  {...formItemLayout}
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(
                    <Select
                      showSearch
                      disabled={bEdit}
                      onSelect={this.handleConstSelect}
                      filterOption={(input, option) =>
                          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    >
                      {oPtinonConst}
                    </Select>)}
                </FormItem>
              );
            }
          }
        } else if (this.props.labelNo) {
          children = (
            <FormItem
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(<InputNumberA
                style={{ width: 'auto', display: 'inline-block', marginRight: 0 }}
                disabled={bEdit}
                min={this.props.min}
                max={this.props.max}
              />)}
            </FormItem>
          );
        } else {
          children = (
            <FormItem
              label={label}
              {...formItemLayout}
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(<InputNumberA
                style={{ width: 'auto', display: 'inline-block', marginRight: 0 }}
                disabled={bEdit}
                min={this.props.min}
                max={this.props.max}
              />)}
            </FormItem>
          );
        }
      } else if (firstDataIndex === 'd') {
        if (sDropDownType === 'sql') {
          if (Object.keys(this.sqlData).length > 0) {
            for (const child of this.sqlData) {
              /* 展示值 */
              let optionValues = '';
              const objValue = [];
              for (const key in child) {
                if (Object.prototype.hasOwnProperty.call(child, key)) {
                  const name = child[key];
                  objValue.push({ key, value: name });
                }
              }
              let i = 0;
              while (i < iVisCount) {
                if (objValue.length >= i) {
                  const { value } = objValue[i];
                  optionValues = optionValues.concat(`-${value}`);
                }
                i += 1;
              }
              optionValues = optionValues.substring(1);
              oPtinon.push(<Option key={child.sId} value={child.sId}>{optionValues}</Option>);
            }
          }
          if (bFirstEmpty) {
            oPtinon.push(<Option key=" ">--</Option>);
          }
          if (bNewRecode) {
            oPtinon.unshift(<Option key="000">NEW RECORD</Option>);
          }
          children = (
            <FormItem
              label={label}
              {...formItemLayout}
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(
                <Select
                  showSearch
                  disabled={bEdit}
                  filterOption={(input, option) =>
                      option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onSelect={this.handleNewRecord}
                  onFocus={this.handleSqlSelectClick}
                >
                  {oPtinon}
                </Select>)}
            </FormItem>
          );
        } else if (sDropDownType === 'const') {
          const { showDropDown } = showConfig;
          const showOption = JSON.parse(showDropDown);
          /* js遍历map对象 */
          const objValue = [];
          for (const key in showOption) {
            if (Object.prototype.hasOwnProperty.call(showOption, key)) {
              const name = showOption[key];
              objValue.push({ key, value: name });
            }
          }
          if (bFirstEmpty) {
            objValue.push({ key: ' ', value: '--' });
          }
          const oPtinonConst = objValue.map(child =>
            <Option key={child.key} value={child.key}>{child.value}</Option>);
          if (this.props.labelNo) {
            children = (
              <FormItem
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(
                  <Select
                    showSearch
                    disabled={bEdit}
                    onSelect={this.handleConstSelect}
                    filterOption={(input, option) =>
                        option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  >
                    {oPtinonConst}
                  </Select>)}
              </FormItem>
            );
          } else {
            children = (
              <FormItem
                label={label}
                {...formItemLayout}
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(
                  <Select
                    showSearch
                    disabled={bEdit}
                    onSelect={this.handleConstSelect}
                    filterOption={(input, option) =>
                        option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  >
                    {oPtinonConst}
                  </Select>)}
              </FormItem>
            );
          }
        } else if (this.props.labelNo) {
          /* 小数位数根据系统参数改变 */
          let floatPrice = '';
          for (let i = 0; i < floatNum;) {
            floatPrice += '\\d';
            i += 1;
          }
          /* 小数位数精度控制 */
          // noinspection JSAnnotator
          const limitDecimals = (values: string | number): string => {
            let reg = '';
            if (floatNum > 0) {
              reg = `^(\\d+).(${floatPrice})*$`;
            } else {
              reg = '^(\\d+).(\\d\\d\\d\\d\\d\\d)*$';
            }
            if (typeof values === 'string') {
              if (values !== undefined && values.indexOf('.') <= -1) {
                reg = '^(\\d+)*$';
                return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1') : '';
              } else {
                return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1.$2') : '';
              }
            } else if (typeof values === 'number') {
              if (values !== undefined && String(values).indexOf('.') <= -1) {
                reg = '^(\\d+)*$';
                return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1') : '';
              } else {
                return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1.$2') : '';
              }
            } else {
              return '';
            }
          };
          children = (
            <FormItem
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(floatNum === 0
                  ?
                    <InputNumberA
                      style={{ width: 'auto', display: 'inline-block', marginRight: 0 }}
                      /* formatter={value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
                       parser={value => value.replace(/\$\s?|(,*)/g, '')} */
                      disabled={bEdit}
                      min={this.props.min}
                      max={this.props.max}
                      formatter={limitDecimals}
                      parser={limitDecimals}
                    />
                  :
                    <InputNumberA
                      /* precision={floatNum} */
                      style={{ width: 'auto', display: 'block', marginRight: 0 }}
                      disabled={bEdit}
                      min={this.props.min}
                      max={this.props.max}
                      formatter={limitDecimals}
                      parser={limitDecimals}
                    />)}
            </FormItem>
          );
        } else {
          children = (
            <FormItem
              label={label}
              {...formItemLayout}
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                // initialValue,
                rules: [{ required: must }],
              })(floatNum === 0
                  ?
                    <InputNumberA
                      style={{ width: 'auto', display: 'inline-block', marginRight: 0 }}
                      disabled={bEdit}
                      min={this.props.min}
                      max={this.props.max}
                    />
                  :
                    <InputNumberA
                      precision={floatNum}
                      style={{ width: 'auto', display: 'block', marginRight: 0 }}
                      disabled={bEdit}
                      min={this.props.min}
                      max={this.props.max}
                    />)}
            </FormItem>
          );
        }
      } else if (firstDataIndex === 'b') {
        if (this.props.labelName) {
          children = (
            <FormItem
              {...formItemLayout}
              className={styles.formItemMag10}
              label={label}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                valuePropName: 'checked',
                rules: [{ required: must }],
              })(
                <Checkbox disabled={bEdit}>{this.props.labelName}</Checkbox>,
              )}
            </FormItem>
          );
        } else {
          children = (
            <FormItem
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              {getFieldDecorator(`${sName}`, {
                valuePropName: 'checked',
                rules: [{ required: must }],
              })(<Checkbox disabled={bEdit}>{label}</Checkbox>)}
            </FormItem>
          );
        }
      } else if (firstDataIndex === 't') {
        children = (
          <FormItem
            label={label}
            {...formItemLayout}
            className={classNameStyle}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            {getFieldDecorator(`${sName}`, {
              rules: [{ required: must }],
            })(<DatePicker format={dateFormat} style={{ width: 'auto', display: 'block' }} disabled={bEdit} />)}
          </FormItem>
        );
      } else if (firstDataIndex === 's') {
        if (this.props.textArea) {
          if (this.props.labelNo) {
            children = (
              <FormItem
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(<TextArea rows={this.props.rows !== undefined ? this.props.rows : 1} disabled={bEdit} />)}
              </FormItem>
            );
          } else {
            children = (
              <FormItem
                label={label}
                {...formItemLayout}
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(<TextArea rows={this.props.rows !== undefined ? this.props.rows : 1} disabled={bEdit} />)}
              </FormItem>
            );
          }
        } else {
          bEdit = bEdit === false ? bEdit : true;
          if (sDropDownType === '' && !(this.state.specific !== undefined)) {
            if (this.props.labelNo) {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(<InputA
                    disabled={bEdit}
                    maxLength={this.props.maxString}
                  />)}
                </FormItem>
              );
            } else {
              children = (
                <FormItem
                  label={label}
                  {...formItemLayout}
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(<InputA
                    disabled={bEdit}
                    maxLength={this.props.maxString}
                  />)}
                </FormItem>
              );
            }
          } else if (this.state.specific !== undefined) {
            /* 主表-特殊下拉 */
            if (bFirstEmpty) {
              oPtinon.push(<Option key=" ">{}</Option>);
            }
            const { specific } = this.state;
            const objValue = [];
            specific.forEach((child) => {
              if (child.handleType !== 'add') {
                objValue.push(child);
              }
            });
            if (sName === 'sContacts') {
              /* 联系人 */
              oPtinon = objValue.map(child =>
                (
                  <Option
                    key={child.sId !== undefined ? child.sId : child.key}
                    value={child.sId !== undefined ? child.sId : child.key}
                  >
                    {child.sContacts}
                  </Option>));
            } else if (sName === 'sCompanyAddress') {
              /* 地址 */
              oPtinon = objValue.map(child =>
                (
                  <Option
                    key={child.sId !== undefined ? child.sId : child.key}
                    value={child.sId !== undefined ? child.sId : child.key}
                  >
                    {child.sDetailAddress}
                  </Option>));
            }
            children = (
              <FormItem
                label={label}
                {...formItemLayout}
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(
                  <Select
                    showSearch
                    disabled={bEdit}
                    filterOption={(input, option) =>
                        option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  >
                    {oPtinon}
                  </Select>)}
              </FormItem>
            );
          } else if (sDropDownType === 'sql') {
            if (Object.keys(this.sqlData).length > 0) {
              for (const child of this.sqlData) {
                /* 展示值 */
                let optionValues = '';
                let recordRow = '';
                const objValue = [];
                for (const key in child) {
                  if (Object.prototype.hasOwnProperty.call(child, key)) {
                    const name = child[key];
                    objValue.push({ key, value: name });
                    recordRow = recordRow.concat(`-${key}:${name}`);
                  }
                }
                let i = 0;
                while (i < iVisCount) {
                  if (objValue.length >= i) {
                    const { value } = objValue[i];
                    optionValues = optionValues.concat(`-${value}`);
                  }
                  i += 1;
                }
                optionValues = optionValues.substring(1);
                oPtinon.push(<Option key={child.sId} value={child.sId} data-recordrow={recordRow}>{optionValues}</Option>);
              }
            }
            if (bFirstEmpty) {
              oPtinon.push(<Option key=" ">--</Option>);
            }
            if (bNewRecode) {
              oPtinon.unshift(<Option key="000">NEW RECORD</Option>);
            }
            children = (
              <FormItem
                label={label}
                {...formItemLayout}
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                {getFieldDecorator(`${sName}`, {
                  // initialValue,
                  rules: [{ required: must }],
                })(
                  <Select
                    showSearch
                    disabled={bEdit}
                    filterOption={(input, option) =>
                        option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    onSelect={this.handleNewRecord}
                    onFocus={this.handleSqlSelectClick}
                  >
                    {oPtinon}
                  </Select>)}
              </FormItem>
            );
          } else if (sDropDownType === 'const') {
            const { showDropDown } = showConfig;
            const showOption = JSON.parse(showDropDown);
            /* js遍历map对象 */
            const objValue = [];
            for (const key in showOption) {
              if (Object.prototype.hasOwnProperty.call(showOption, key)) {
                const name = showOption[key];
                objValue.push({ key, value: name });
              }
            }
            if (bFirstEmpty) {
              objValue.push({ key: ' ', value: '--' });
            }
            const oPtinonConst = objValue.map(child =>
              <Option key={child.key} value={child.key}>{child.value}</Option>);
            if (this.props.labelNo) {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(
                    <Select
                      showSearch
                      disabled={bEdit}
                      onSelect={this.handleConstSelect}
                      filterOption={(input, option) =>
                          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    >
                      {oPtinonConst}
                    </Select>)}
                </FormItem>
              );
            } else {
              children = (
                <FormItem
                  label={label}
                  {...formItemLayout}
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  {getFieldDecorator(`${sName}`, {
                    // initialValue,
                    rules: [{ required: must }],
                  })(
                    <Select
                      showSearch
                      disabled={bEdit}
                      onSelect={this.handleConstSelect}
                      filterOption={(input, option) =>
                          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    >
                      {oPtinonConst}
                    </Select>)}
                </FormItem>
              );
            }
          } else if (sDropDownType === 'popup') {
            let oPtinonConst = '';
            if (this.props.dataList !== undefined && Object.keys(this.props.dataList).length > 0) {
              const opvalue = this.props.dataList[`${sName}`];
              if (opvalue !== undefined) {
                /* 约定弹窗数据展示时候为[-]进行分隔key[-]value */
                const op = opvalue.split('[-]');
                oPtinonConst = <Option key={op[0]} value={op[0]}>{op[1]}</Option>;
              }
            }
            if (this.state.showConfig.sActiveId !== undefined && this.state.showConfig.sActiveId !== '') {
              if (this.props.labelNo) {
                children = (
                  <FormItem
                    className={classNameStyle}
                    style={{ display: bVisible ? 'block' : 'none' }}
                  >
                    <InputGroup compact className={styles.inputGroup}>
                      {getFieldDecorator(`${sName}`, {
                        rules: [{ required: must }],
                      })(
                        <Select
                          disabled
                          style={{ width: '100%' }}
                        >
                          {oPtinonConst}
                        </Select>)}
                      <InputA disabled={bEdit} style={{ width: '32px' }} className={styles.iconAdd} prefix={<Icon type="plus" onClick={this.handlePpopUp.bind(this, bEdit)} />} />
                    </InputGroup>
                  </FormItem>
                );
              } else {
                children = (
                  <FormItem
                    label={label}
                    {...formItemLayout}
                    className={classNameStyle}
                    style={{ display: bVisible ? 'block' : 'none' }}
                  >
                    <InputGroup compact className={styles.inputGroup}>
                      {getFieldDecorator(`${sName}`, {
                        // initialValue,
                        rules: [{ required: must }],
                      })(
                        <Select
                          disabled
                          style={{ width: '100%' }}
                        >
                          {oPtinonConst}
                        </Select>)}
                      <InputA disabled={bEdit} style={{ width: '32px' }} className={styles.iconAdd} prefix={<Icon type="plus" onClick={this.handlePpopUp.bind(this, bEdit)} />} />
                    </InputGroup>
                  </FormItem>
                );
              }
            } else {
              children = (
                <FormItem
                  label={label}
                  {...formItemLayout}
                  className={classNameStyle}
                  style={{ display: 'block' }}
                >
                  <InputGroup compact className={styles.inputGroup}>
                    {getFieldDecorator(`${sName}`, {
                      // initialValue,
                      rules: [{ required: must }],
                    })(
                      <Select
                        disabled
                        showArrow={false}
                      >
                        {oPtinonConst}
                      </Select>)}
                  </InputGroup>
                </FormItem>
              );
            }
          }
        }
      } else if (firstDataIndex === 'c') {
        const options = this.handleCollectData();
        children = (
          <FormItem
            label={label}
            {...formItemLayout}
            className={classNameStyle}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            {getFieldDecorator(`${sName}`, {
              initialValue: ['北京市', '市辖区', '东城区'],
              rules: [{ required: must }],
            })(<Cascader
              options={options}
              changeOnSelect
              placeholder="请选择省市区"
              disabled={bEdit}
            />)}
          </FormItem>
        );
      }
      return children;
    } else if (editable) {
      /* 表格编辑状态 */
      const { value } = this.props;
      const classNameStyle = styles.formItemMargin0;
      const firstDataIndex = sName.substring(0, 1);
      let children = '';
      if (firstDataIndex === 'i') {
        children = (
          <FormItem
            className={classNameStyle}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            <InputNumberA
              value={value}
              className={styles.inputNum}
              disabled={bEdit}
              onChange={e => this.handleListChange(e)}
            />
          </FormItem>
        );
      } else if (firstDataIndex === 'd') {
        let floatPrice = '';
        for (let i = 0; i < floatNum;) {
          floatPrice += '\\d';
          i += 1;
        }
        /* 小数位数根据系统参数改变 */
        // noinspection JSAnnotator
        const limitDecimals = (values: string | number): string => {
          let reg = '';
          if (floatNum > 0) {
            reg = `^(\\d+).(${floatPrice})*$`;
          } else {
            reg = '^(\\d+).(\\d\\d\\d\\d\\d\\d)*$';
          }
          if (typeof values === 'string') {
            if (values !== undefined && values.indexOf('.') <= -1) {
              reg = '^(\\d+)*$';
              return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1') : '';
            } else {
              return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1.$2') : '';
            }
          } else if (typeof values === 'number') {
            if (values !== undefined && String(values).indexOf('.') <= -1) {
              reg = '^(\\d+)*$';
              return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1') : '';
            } else {
              return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1.$2') : '';
            }
          } else {
            return '';
          }
        };
        const { dTotalMoneyMin, dTotalMoneyMax, maxLength } = props;
        children = (
          <FormItem
            className={classNameStyle}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            {
              floatNum === 0
                ?
                  <InputNumberA
                    className={styles.inputNum}
                    disabled={bEdit}
                    value={value}
                    onChange={e => this.handleListChange(e)}
                    min={dTotalMoneyMin}
                    max={dTotalMoneyMax}
                    maxLength={maxLength}
                  />
                :
                  <InputNumberA
                    className={styles.inputNum}
                    disabled={bEdit}
                    value={value}
                    onChange={e => this.handleListChange(e)}
                    min={dTotalMoneyMin}
                    max={dTotalMoneyMax}
                    maxLength={maxLength}
                    formatter={limitDecimals}
                    parser={limitDecimals}
                  />
            }
          </FormItem>
        );
      } else if (firstDataIndex === 'b') {
        let valueFlag = Boolean(value);
        if (value === 1 || value) {
          valueFlag = true;
        } else if (value === 0 || !value) {
          valueFlag = false;
        }
        children = (
          <FormItem
            className={styles.tableCheckBox}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            <Checkbox disabled={bEdit} defaultChecked={valueFlag} checked={valueFlag} onChange={e => this.handleListChange(e.target.checked)} />
          </FormItem>
        );
      } else if (firstDataIndex === 't') {
        children = (
          <FormItem
            className={styles.tableDataPicker}
            id="tableDataPicker"
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            <DatePicker
              format={dateFormat}
              value={value}
              disabled={bEdit}
              onChange={(data, dateString) => this.handleListChange(dateString)}
              placeholder=""
            />
          </FormItem>
        );
      } else if (firstDataIndex === 's') {
        /* 普通输入框 */
        let oPtinon = [];
        if (sDropDownType === '') {
          children = (
            <FormItem
              className={styles.editInput}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              <InputA
                disabled={bEdit}
                value={value}
                onChange={e => this.handleListChange(e)}
                maxLength={this.props.maxString}
              />
            </FormItem>
          );
        } else if (this.state.specific && this.state.specific !== undefined) {
          /* 特殊下拉 暂未处理 */
          if (bFirstEmpty) {
            oPtinon.push(<Option key=" ">{}</Option>);
          }
          const objValue = this.state.specificData;
          oPtinon = objValue.map(child =>
            <Option key={child.key}>{child.value}</Option>);
          children = (
            <FormItem
              className={classNameStyle}
              style={{ display: bVisible ? 'block' : 'none' }}
            >
              <Select
                value={value}
                showSearch
                disabled={bEdit}
                onChange={e => this.handleListChange(e)}
                filterOption={(input, option) =>
                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                style={{ width: iFitWidth - 2 }}
              >
                {oPtinon}
              </Select>
            </FormItem>
          );
        } else {
          const { iVisCount } = showConfig;
          if (sDropDownType === 'sql') {
            /* 根据SQL条件值来判定sSqlCondition的具体传值 */
            const sqlDataLength = Object.keys(this.sqlData).length > 0;
            if (sqlDataLength) {
              for (const child of this.sqlData) {
                /* 展示值 */
                let optionValues = '';
                const objValue = [];
                let recordRow = '';
                for (const key in child) {
                  if (Object.prototype.hasOwnProperty.call(child, key)) {
                    const name = child[key];
                    objValue.push({ key, value: name });
                    recordRow = recordRow.concat(`-${key}:${name}`);
                  }
                }
                let i = 0;
                while (i < iVisCount) {
                  if (objValue.length >= i) {
                    const v = objValue[i].value;
                    optionValues = optionValues.concat(`-${v}`);
                  }
                  i += 1;
                }
                optionValues = optionValues.substring(1);
                oPtinon.push(<Option key={child.sId} value={child.sId} data-recordrow={recordRow}>{optionValues}</Option>);
              }
            }
            if (bFirstEmpty) {
              oPtinon.push(<Option key=" ">--</Option>);
            }
            if (bNewRecode) {
              oPtinon.unshift(<Option key="000">NEW RECORD</Option>);
            }
            if (props.comboxSelect) {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  <AutoComplete
                    disabled={bEdit}
                    onSelect={this.handleNewRecord}
                    onFocus={this.handleSqlSelectClick}
                    onChange={(e, option) => this.handleListChange(e, 'select', option)}
                    value={value}
                  >
                    {oPtinon}
                  </AutoComplete>
                </FormItem>
              );
            } else {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  <Select
                    style={{ width: iFitWidth - 2 }}
                    className={styles.editSelect}
                    value={value !== undefined && value !== '' ? value : ' '}
                    showSearch
                    disabled={bEdit}
                    filterOption={(input, option) =>
                    option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                    onSelect={this.handleNewRecord}
                    onFocus={this.handleSqlSelectClick}
                    onChange={(e, option) => this.handleListChange(e, 'select', option)}
                  >
                    {oPtinon}
                  </Select>
                </FormItem>
              );
            }
          } else if (sDropDownType === 'const') {
            const { showDropDown } = showConfig;
            const showOption = JSON.parse(showDropDown);
            /* js遍历map对象 */
            const objValue = [];
            if (bFirstEmpty) {
              objValue.push({ key: ' ', value: '--' });
            }
            for (const key in showOption) {
              if (Object.prototype.hasOwnProperty.call(showOption, key)) {
                const name = showOption[key];
                objValue.push({ key, value: name });
              }
            }
            const oPtinonConst = objValue.map(child =>
              <Option key={child.key} value={child.key}>{child.value}</Option>);
            children = (
              <FormItem
                className={classNameStyle}
                style={{ display: bVisible ? 'block' : 'none' }}
              >
                <Select
                  className={styles.editSelect}
                  value={value !== undefined && value !== '' ? value : ' '}
                  showSearch
                  disabled={bEdit}
                  onChange={e => this.handleListChange(e)}
                  filterOption={(input, option) =>
                  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  style={{ width: iFitWidth - 2 }}
                >
                  {oPtinonConst}
                </Select>
              </FormItem>
            );
          } else if (sDropDownType === 'popup') {
            let oPtinonConst = '';
            let opv = '';
            /* 约定弹窗数据展示时候为[-]进行分隔key[-]value */
            if (value !== undefined) {
              const op = value.split('[-]');
              [opv] = op;
              oPtinonConst = <Option key={op[0]} value={op[0]}>{op[1]}</Option>;
            }
            /* 弹窗组件为本身无需弹窗选择，而是其他弹窗回带键值对方式。根据是否配置显示窗体来判断为主动弹窗组件还是为其他弹窗回带展示组件 */
            if (this.state.showConfig.sActiveId !== undefined && this.state.showConfig.sActiveId !== '') {
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  <InputGroup compact className={styles.tableInputGroup}>
                    <Select
                      className={styles.editSelect}
                      value={opv}
                      disabled
                      style={{ width: iFitWidth - 2 }}
                    >
                      {oPtinonConst}
                    </Select>
                    <InputA
                      disabled={bEdit}
                      style={{ width: '16px' }}
                      className={styles.iconAdd}
                      prefix={<Icon type="plus" onClick={this.handlePpopUp.bind(this, bEdit)} />}
                    />
                  </InputGroup>
                </FormItem>
              );
            } else {
              /* 不可编辑框展现值为键值对形式 */
              children = (
                <FormItem
                  className={classNameStyle}
                  style={{ display: bVisible ? 'block' : 'none' }}
                >
                  <InputGroup compact className={styles.tableInputGroup}>
                    <Select
                      className={styles.editSelect}
                      value={opv}
                      disabled
                      style={{ width: iFitWidth - 2 }}
                      showArrow={false}
                    >
                      {oPtinonConst}
                    </Select>
                  </InputGroup>
                </FormItem>
              );
            }
          }
        }
      } else if (firstDataIndex === 'c') {
        const options = this.handleCollectData();
        children = (
          <FormItem
            className={classNameStyle}
            style={{ display: bVisible ? 'block' : 'none' }}
          >
            <Cascader
              options={options}
              changeOnSelect
              onChange={this.handleProvinceChange}
              placeholder="请选择省市区"
              disabled={bEdit}
              value={value}
            />
          </FormItem>
        );
      }
      return children;
    }
  };

  render() {
    const { props, state } = this;
    const object = { ...state };
    return (
      <div>
        {this.handleFields(object, props)}
      </div>
    );
  }
}

export default ShowType;
